using System;

namespace NumericalRecipes.SolutionOfLinearAlgebraicEquations
{
	/// <summary>
	/// Computes (a2 + b2)^{1/2} without destructive underflow or overflow.
	/// </summary>
	public class Pythag
	{
		public Pythag()
		{
		}
        public double pythag(double a, double b)
		{
			double absa,absb;
			absa=Math.Abs(a);
			absb=Math.Abs(b);
			if (absa > absb) return absa*Math.Sqrt(1.0+(absb/absa)*(absb/absa));
			else return (absb == 0.0 ? 0.0 : absb*Math.Sqrt(1.0+(absa/absb)*(absa/absb)));
		} 
	}
}
